//
//  ChooseTableViewCell.m
//  WeCommunity
//
//  Created by mac on 2017/7/20.
//  Copyright © 2017年 lzy. All rights reserved.
//

#import "ChooseTableViewCell.h"
#import "ChooseSexModel.h"

@interface ChooseTableViewCell ()

@property (nonatomic,strong) UILabel * titleLabel;

@property (nonatomic,strong) UIImageView * arrowImage;

@property (nonatomic,strong) UIView * lineView;

@property (nonatomic,strong) UIView * topLineView;

@property (nonatomic,strong) UIView * botLineView;

@end

@implementation ChooseTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.backgroundColor = [UIColor whiteColor];
        
        CGFloat height = 44;
        
        self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(15,0,100, height)];
        self.titleLabel.textColor = [UIColor blackColor];
        self.titleLabel.font = PFR_FONT(16);
        [self.contentView addSubview:self.titleLabel];
        
        self.arrowImage = [[UIImageView alloc] initWithFrame:CGRectMake(KScreen_Width - 30, height / 2 - 8, 16, 16)];
        self.arrowImage.contentMode = UIViewContentModeScaleAspectFill;
        self.arrowImage.clipsToBounds = YES;
        self.arrowImage.image = [UIImage imageNamed:@"arrow_choose"];
        [self.contentView addSubview:self.arrowImage];
        
        self.lineView = [[UIView alloc] initWithFrame:CGRectMake(15, height - 0.5, KScreen_Width - 15, 0.5)];
        self.lineView .backgroundColor = LINE_COLOR;
        [self.contentView addSubview:self.lineView ];
        
        self.topLineView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KScreen_Width, 0.5)];
        self.topLineView .backgroundColor = LINE_COLOR;
        [self.contentView addSubview:self.topLineView ];
        
        self.botLineView = [[UIView alloc] initWithFrame:CGRectMake(0, height - 0.5, KScreen_Width, 0.5)];
        self.botLineView .backgroundColor = LINE_COLOR;
        [self.contentView addSubview:self.botLineView ];
        

        
    }
    return self;
}

-(void)creatCellWithModel:(id )model
{
    ChooseSexModel * sexModel = model;
    if ([sexModel.sex integerValue] == 1) {
        self.titleLabel.text = KNSLocal(@"Sex_Men");
    }else if ([sexModel.sex integerValue] == 2){
        self.titleLabel.text = KNSLocal(@"Sex_Women");
    }
    
    self.arrowImage.hidden = !sexModel.choose;
}


-(void)needAddTopLine:(BOOL)topLine addBottomLine:(BOOL)bottomLine
{
    self.topLineView.hidden = !topLine;
    
    self.lineView.hidden = bottomLine;
    self.botLineView.hidden = !bottomLine;
}


@end
